<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
// es6
/*    
let a = {username: 'zs'}
Object.assign(a, {age: 20}) //把右边对象赋值到左边 {username: 'zs', age: 20}
*/
/*
let b =  {age: 20}
for(var k in b){
    a[k] = b[k] //a.age = b.age
}
*/
/*
let obj = {}

obj.username = 'zs'
obj['age'] = 20

// obj[表达式]
let k = 'sex'
obj[k] = 1  //obj['sex']= 1

obj[1+1] = 'abc' //obj[2] = 'abc'
*/
let obj = {
    usernam: 'zs',
    'age': 20,
    ['sex']: 1,
    [1+1]: 'abc'
}
console.log(obj)

</script>
</html>